home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- Caption = "Event sample #2"
- ClientHeight = 3720
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 5940
- Height = 4125
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 3720
- ScaleWidth = 5940
- Top = 1140
- Width = 6060
- Begin TextBox Text4
- Height = 375
- Left = 300
- TabIndex = 4
- Top = 2340
- Width = 1815
- End
- Begin TextBox Text3
- Height = 375
- Left = 300
- TabIndex = 2
- Top = 1800
- Width = 1815
- End
- Begin TextBox Text2
- Height = 375
- Left = 300
- TabIndex = 1
- Text = "600"
- Top = 1200
- Width = 1815
- End
- Begin TextBox Text1
- Height = 435
- Left = 300
- TabIndex = 0
- Top = 540
- Width = 1815
- End
- Begin Label Label1
- Caption = "Enter #>500 and press tab."
- Height = 255
- Left = 2220
- TabIndex = 3
- Top = 600
- Width = 3015
- End
- Option Explicit
- ' An infinite loop can be created as each control
- ' fails its valid condition and attempts to set
- ' the focus back to itself.
- Sub Text1_LostFocus ()
- If Val(Text1.Text) > 500 Then Text1.SetFocus
- End Sub
- Sub Text2_LostFocus ()
- If Val(Text2.Text) > 500 Then Text2.SetFocus
- End Sub
- ' A stack space overflow can be created when
- ' a change in one control causes a change in
- ' a second control.
- Sub Text3_Change ()
- text4.Text = Str$(Val(text4.Text) + 1)
- End Sub
- Sub Text4_Change ()
- text3.Text = Str$(Val(text3.Text) + 1)
- End Sub
-